<template>
  <div class="contents">
    <div class="left">
      <div class="left-1">
        <titleBox title="数值" />
        <div class="eventList_box">
          <div class="table_box">
            <div class="table_heard">
              <span>名称</span>
              <span>值</span>
              <span>单位</span>
            </div>
            <div class="table_body">
              <el-scrollbar class="table_body_content" ref="scrollbarRef">
                <div
                  class="table_content_item"
                  v-for="(item, index) in eventRegisterData"
                  :key="index"
                >
                  <span :title="item.name">{{ item.name }}</span>
                  <span>{{ item.count }}</span>
                  <span>{{ item.unit }}</span>
                </div>
              </el-scrollbar>
            </div>
          </div>
        </div>
      </div>
      <div class="left-2">
        <titleBox title="数值" />
        <div class="eventList_box">
          <div class="table_box">
            <div class="table_heard">
              <span>名称</span>
              <span>值</span>
              <span>单位</span>
            </div>
            <div class="table_body">
              <el-scrollbar class="table_body_content" ref="scrollbarRef">
                <div
                  class="table_content_item"
                  v-for="(item, index) in eventRegisterData"
                  :key="index"
                >
                  <span :title="item.name">{{ item.name }}</span>
                  <span>{{ item.count }}</span>
                  <span>{{ item.unit }}</span>
                </div>
              </el-scrollbar>
            </div>
          </div>
        </div>
      </div>
      <div class="left-3">
        <titleBox title="数值" />
        <div class="eventList_box">
          <div class="table_box">
            <div class="table_heard">
              <span>名称</span>
              <span>最高</span>
              <span>最低</span>
              <span>单位</span>
            </div>
            <div class="table_body">
              <el-scrollbar class="table_body_content" ref="scrollbarRef">
                <div
                  class="table_content_item"
                  v-for="(item, index) in leftBottomData"
                  :key="index"
                >
                  <span :title="item.name">{{ item.name }}</span>
                  <span>{{ item.count1 }}</span>
                  <span>{{ item.count2 }}</span>
                  <span>{{ item.unit }}</span>
                </div>
              </el-scrollbar>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="center">
      <div class="centerTop">
        <div class="textContent">
          <div class="text-textContent">生产料号</div>
          <div class="dotted-line"></div>
          <div class="cont-textContent">4RGA1376</div>
        </div>
        <div class="textContent">
          <div class="text-textContent">生产/计划</div>
          <div class="dotted-line"></div>
          <div class="cont-textContent">337/350</div>
        </div>
        <div class="textContent">
          <div class="text-textContent">时间</div>
          <div class="dotted-line"></div>
          <div class="cont-textContent">2024-10-30 11:00:28</div>
        </div>
        <div class="textContent">
          <div class="text-textContent">设置</div>
          <div class="dotted-line"></div>
          <div class="cont-textContent" @click="setting">
            <div class="setButton">
              {{ animationType ? "关闭" : "启动" }}
            </div>
          </div>
        </div>
      </div>
      <div class="machine">
        <img src="../../../assets/machine1.png" alt="" class="machine-img" />
        <div :class="['smallSet1', { rotate: animationType }]"></div>
        <div :class="['smallSet2', { rotate: animationType }]"></div>
        <div :class="['smallSet3', { rotate: animationType }]"></div>
        <div :class="['smallSet4', { rotate: animationType }]"></div>
        <div :class="['bigSet', { rotate: animationType }]"></div>
        <div :class="['smallSet5', { rotate: animationType }]"></div>
      </div>
    </div>
    <div class="right">
      <div class="right-1">
        <titleBox title="数值" />
        <div class="eventList_box">
          <div class="table_box">
            <div class="table_heard">
              <span>名称</span>
              <span>开启状态</span>
            </div>
            <div class="table_body">
              <el-scrollbar class="table_body_content" ref="scrollbarRef">
                <div
                  class="table_content_item"
                  v-for="(item, index) in checkType"
                  :key="index"
                >
                  <span :title="item.name">{{ item.name }}</span>
                  <!-- <span>{{ item.type }}</span> -->
                  <div>
                    <div :class="['pie', { checkPie: item.type === 1 }]"></div>
                  </div>
                </div>
              </el-scrollbar>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import titleBox from "./title-box.vue";
import { ref } from "vue";
const eventRegisterData = ref<any>([
  {
    name: "终出机机头压力",
    count: "0.8",
    unit: "Mps",
  },
  {
    name: "终出机机头压力",
    count: "0.8",
    unit: "Mps",
  },
  {
    name: "终出机机头压力",
    count: "0.8",
    unit: "Mps",
  },
  {
    name: "终出机机头压力",
    count: "0.8",
    unit: "Mps",
  },
  {
    name: "终出机机头压力",
    count: "0.8",
    unit: "Mps",
  },
]);

const leftBottomData = ref([
  {
    name: "机头温度",
    count1: "0.8",
    count2: "0.8",
    unit: "Mps",
  },
  {
    name: "螺杆温度",
    count1: "0.8",
    count2: "0.8",
    unit: "Mps",
  },
]);

const checkType = ref([
  {
    name: "贴合切刀上升位",
    type: 1,
  },
  {
    name: "贴合切刀下降位",
    type: 0,
  },
  {
    name: "小压轮上升位",
    type: 0,
  },
  {
    name: "小压轮下降位",
    type: 0,
  },
  {
    name: "大压轮下降位",
    type: 1,
  },
  {
    name: "大压轮上升位",
    type: 0,
  },
  {
    name: "冷却灌水口",
    type: 1,
  },
  {
    name: "贴合切刀下降位",
    type: 0,
  },
  {
    name: "大压轮下降位",
    type: 1,
  },
  {
    name: "大压轮下降位",
    type: 1,
  },
  {
    name: "小压轮上升位",
    type: 0,
  },
  {
    name: "小压轮下降位",
    type: 0,
  },
  {
    name: "大压轮上升位",
    type: 0,
  },
  {
    name: "冷却灌水口",
    type: 1,
  },
  {
    name: "贴合切刀上升位",
    type: 1,
  },
  {
    name: "贴合切刀下降位",
    type: 0,
  },
]);

//动画
const animationType = ref(false);
const setting = () => {
  animationType.value = !animationType.value;
};
</script>

<style lang="scss" scoped>
@mixin smallSet() {
  background-image: url("../../../assets/small-setting.png");
  width: 30px;
  height: 30px;
  background-size: cover;
}
.contents {
  display: flex;
  justify-content: space-between;
  height: 100%;
}
.left,
.right {
  height: 100%;
  width: 20%;
  //   background: #fff;
  box-sizing: border-box;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.left-1,
.left-2,
.left-3 {
  width: 100%;
  height: 32%;
  //   background-color: rgba($color: #000000, $alpha: 0.1);
}
.right-1 {
  width: 100%;
  height: 100%;
  background-color: rgba($color: #000000, $alpha: 0.1);
}

/* 表格样式 */
.eventList_box {
  width: 100%;
  height: calc(100% - 30px);
  background: rgba(45, 117, 194, 0.23);
  border-radius: 4px;
  border: 1px solid rgba(45, 117, 194, 0.39);
  margin-top: 10px;
  box-sizing: border-box;
  padding: 5px;
}
.table_box {
  width: 100%;
  height: 100%;
}
.table_heard {
  width: 100%;
  height: 20px;
  background-size: 100% 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.table_heard span {
  font-size: 13px;
  color: #00a8e0;
}
.table_heard span:nth-child(1) {
  width: 40.33%;
}
.table_heard span:nth-child(2) {
  width: 23.33%;
}

.table_heard span:nth-child(3) {
  width: 18.33%;
}
.table_heard span:nth-child(4) {
  width: 15%;
}
.table_body {
  width: 100%;
  height: calc(100% - 32px);
}

.table_body_content {
  width: 100%;
}
.table_content_item {
  //   width: 100%;
  height: 36px;
  //   background: rgba(101, 255, 235, 0.1);
  border-bottom: 1px solid rgba(125, 255, 214, 0.22);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #ffffff;
  font-size: 12px;
  cursor: pointer;
}

.table_content_item span:nth-child(1) {
  width: 40.33%;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table_content_item span:nth-child(2) {
  width: 23.33%;
}
.table_content_item span:nth-child(3) {
  width: 18.33%;
}
.table_content_item span:nth-child(4) {
  width: 15%;
}

.right-1 {
  .eventList_box {
    width: 100%;
    height: calc(100% - 30px);
    background: rgba(45, 117, 194, 0.23);
    border-radius: 4px;
    border: 1px solid rgba(45, 117, 194, 0.39);
    margin-top: 10px;
    box-sizing: border-box;
    padding: 5px;
  }
  .table_box {
    width: 100%;
    height: 100%;
  }
  .table_heard {
    width: 100%;
    height: 20px;
    background-size: 100% 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .table_heard span {
    font-size: 13px;
    color: #00a8e0;
  }
  .table_heard span:nth-child(1) {
    width: 40.33%;
  }
  .table_heard span:nth-child(2) {
    width: 23.33%;
  }
  .table_body {
    width: 100%;
    height: calc(100% - 32px);
  }

  .table_body_content {
    width: 100%;
  }
  .table_content_item {
    //   width: 100%;
    height: 36px;
    //   background: rgba(101, 255, 235, 0.1);
    border-bottom: 1px solid rgba(125, 255, 214, 0.22);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
    font-size: 12px;
    cursor: pointer;
  }

  .table_content_item span:nth-child(1) {
    width: 40.33%;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .table_content_item div:nth-child(2) {
    width: 23.33%;
  }
  .pie {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #3078c5;
  }
}
.checkPie {
  //   background-color: #00a8e0;
  //   border: none;
  background-color: #00a8e0;
  border: none;
  background: linear-gradient(to right, #00a8e0, #00c6ff); /* 添加水平渐变 */
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.5),
    /* 内部发光效果 */ 0 0 15px rgba(0, 168, 224, 0.5); /* 外部阴影效果 */
  transition: all 0.3s ease; /* 添加过渡效果 */
}

.checkPie:hover {
  background: linear-gradient(
    to right,
    #00c6ff,
    #00a8e0
  ); /* 鼠标悬停时改变渐变方向 */
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.7),
    /* 强化内部发光效果 */ 0 0 25px rgba(0, 168, 224, 0.7); /* 强化外部阴影效果 */
}

/* 中间部分样式 */
.center {
  width: calc(100% - 40%);
  height: 100%;
}
.centerTop {
  width: 100%;
  height: 100px;
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  padding: 0 20px;
}
.setButton {
  width: 40px;
  height: 20px;
  font-size: 12px;
  background-color: rgba(255, 255, 255, 0.09); /* 半透明白色背景 */
  backdrop-filter: blur(10px); /* 模糊效果 */
  -webkit-backdrop-filter: blur(10px); /* Safari 浏览器支持 */
  border-radius: 5px; /* 圆角 */
  border: none; /* 去掉边框 */
  color: #0088d2;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer; /* 鼠标指针样式 */
  transition: transform 0.1s ease-in-out; /* 平滑过渡效果 */
}

.setButton:active {
  transform: scale(0.5); /* 缩放到原来的90% */
}

.machine {
  width: 100%;
  height: calc(100% - 120px);
  //   background-color: red;
  box-sizing: border-box;
  padding: 0 20px;
  position: relative;

  .machine-img {
    width: 100%;
    height: 55%;
  }
  .smallSet1 {
    @include smallSet();
    position: absolute;
    top: 40.5%;
    left: 30%;
  }
  .smallSet2 {
    @include smallSet();
    position: absolute;
    top: 11%;
    left: 34.3%;
  }
  .smallSet3 {
    @include smallSet();
    position: absolute;
    top: 27.5%;
    left: 39.9%;
  }
  .smallSet4 {
    @include smallSet();
    position: absolute;
    top: 17.6%;
    left: 44.5%;
  }
  .smallSet5 {
    @include smallSet();
    position: absolute;
    top: 32%;
    left: 64%;
  }

  .bigSet {
    background-image: url("../../../assets/big-setting.png");
    width: 60px;
    height: 60px;
    background-size: cover;
    position: absolute;
    top: 33.5%;
    left: 52%;
  }
  .rotate {
    transform-origin: center;
    animation: spin 2s linear infinite;
  }
  @keyframes spin {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }
}
.textContent {
  width: 20%;
  height: 60px;
  border: 1px solid #3078c5;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  padding: 15px;
  .text-textContent {
    width: 100%;
    color: #a4abb2;
    text-align: center;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 700;
  }
  .dotted-line {
    width: 100%;
    border-top: 1px dashed #3078c5; /* 使用 1px 边框 */
    transform: scaleY(0.5); /* 缩小 Y 方向的尺寸 */
    transform-origin: top; /* 从顶部开始缩小 */
    margin: 0 auto; /* 如果需要居中显示 */
  }
  .cont-textContent {
    margin-top: 5px;
    font-size: 14px;

    width: 100%;
    color: #5074da;
    text-align: center;
  }
}
</style>